# Maintainer:
# Contributor: Caleb Maclennan <caleb@alerque.com>
# Contributor: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Balló György <ballogyor+arch at gmail dot com>
# Contributor: Tobias Bohrmann (PlainTextField) <honeypot.carbage@aechelon.de>

pkgname=tepl
pkgver=6.4.0
pkgrel=2
epoch=1
_commit=d1e9cc2e4a0738f68d9002f13724b7239f075844  # tags/6.4.0^0
pkgdesc="Library that eases the development of GtkSourceView-based text editors and IDEs"
url="https://gitlab.gnome.org/swilmet/tepl"
arch=(loong64 x86_64)
license=(LGPL3)
depends=(amtk
         gtksourceview4)
makedepends=(gobject-introspection
             git
             gtk-doc
             meson
             vala)
checkdepends=(xorg-server-xvfb)
source=("git+https://gitlab.gnome.org/swilmet/tepl.git#commit=$_commit")
sha256sums=('SKIP')

prepare() {
	cd $pkgname
}

pkgver() {
	cd $pkgname
	git describe --tags | sed 's/[^-]*-g/r&/;s/-/+/g'
}

build() {
	arch-meson $pkgname build -D gtk_doc=true
	meson compile -C build
}

check() {
	xvfb-run -s '-screen 0 1920x1080x24 -nolisten local' \
		meson test -C build --print-errorlogs
}

package() {
	depends+=(libamtk-5.so
	          libgtksourceview-4.so
	          libg{d,t}k-3.so
	          libg{lib,object,io}-2.0.so)
	provides+=("libtepl-${pkgver%%.*}.so")
	meson install -C build --destdir "$pkgdir"
}
